

/*------------------------------------------ Node */
/*------------------------------------------ Node */

int NODE_IDS = 0;

typedef struct ListNode Node;
struct ListNode {
	int id;
	float data;
	Node *next;
	Node *prev;
} ListNode;

Node *newNode();
Node *initNode(Node *n, float data);
Node *getNode(float data);
void deleteNode(Node *n);

void setNodeData(Node *n, float data);
void dumpNode(Node *n);
int hasNext(Node *n);
int hasPrev(Node *n);


/*------------------------------------------ List */
/*------------------------------------------ List */

typedef struct LList List;
struct LList {
	int size;
	Node *head;
	Node *tail;
} LList;
List *newList();
List *initList(List *l, Node *head);
List *getList(Node *head);
void deleteList(List *l);

Node *getHead(List *l);
Node *getTail(List *l);
void dumpHeadTail(List *l);

void addInHead(List *l, Node *n);
Node *removeHead(List *l);
void addInTail(List *l, Node *n);
Node *removeTail(List *l);


/*------------------------------------------ Iterator */
/*------------------------------------------ Iterator */

typedef struct ListIterator Iterator;
struct ListIterator {
	List *list;
	Node *current;
} ListIterator;

Iterator *newIterator();
Iterator *initIterator(Iterator *itr, List *l);
Iterator *getIterator(List *l);
void deleteIterator(Iterator *itr);

Iterator *getListIterator();

int moveNext(Iterator *itr);
int movePrev(Iterator *itr);

void dumpTraverse(Iterator *itr);

void addElement(Iterator *itr, float data);
float *toArray(Iterator *itr);
float sum(Iterator *itr);
float average(Iterator *itr);
float deviation(Iterator *itr);

